import { d as defineComponent, r as ref, u as useRouter, a as resolveComponent, o as openBlock, c as createElementBlock, b as createVNode, w as withCtx, F as Fragment, e as renderList, t as toDisplayString, f as createBaseVNode, g as createBlock, _ as _export_sfc, s as storeToRefs, h as unref, i as createTextVNode, p as pushScopeId, j as popScopeId } from "./index-NZguwuNX.js";
import { u as useCounterStore } from "./index-F6B3vg3q.js";
const _imports_0 = "" + new URL("user-hOzLVbIC.webp", import.meta.url).href;
const _hoisted_1$1 = {
  class: "df jc-sb w100",
  style: { "height": "100%" }
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  __name: "HeaderMenu",
  props: {
    menuItem: {}
  },
  setup(__props) {
    const activeIndex = ref(localStorage.getItem("activeIndex") || "1");
    const router = useRouter();
    const handleSelect = (key, keyPath) => {
      console.log(key, keyPath);
    };
    const to_page = (item) => {
      console.log(item);
      localStorage.setItem("activeIndex", item.id);
      router.push("/index" + item.path);
    };
    return (_ctx, _cache) => {
      const _component_el_icon = resolveComponent("el-icon");
      const _component_el_menu_item = resolveComponent("el-menu-item");
      const _component_el_menu = resolveComponent("el-menu");
      return openBlock(), createElementBlock("div", _hoisted_1$1, [
        createVNode(_component_el_menu, {
          style: { "height": "100%" },
          "default-active": activeIndex.value,
          "active-text-color": "#ffd04b",
          "background-color": "#545c64",
          "text-color": "#fff",
          class: "el-menu-vertical-demo",
          mode: "vertical",
          ellipsis: false,
          onSelect: handleSelect
        }, {
          default: withCtx(() => [
            (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItem, (item) => {
              return openBlock(), createBlock(_component_el_menu_item, {
                class: "",
                index: item.id,
                key: item.id,
                onClick: ($event) => to_page(item)
              }, {
                default: withCtx(() => [
                  createVNode(_component_el_icon),
                  createBaseVNode("span", null, toDisplayString(item.name), 1)
                ]),
                _: 2
              }, 1032, ["index", "onClick"]);
            }), 128))
          ]),
          _: 1
        }, 8, ["default-active"])
      ]);
    };
  }
});
const HeaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-a040d0bf"]]);
const _withScopeId = (n) => (pushScopeId("data-v-00a973f5"), n = n(), popScopeId(), n);
const _hoisted_1 = { class: "index" };
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createBaseVNode("h3", { class: "df ai-c" }, "网吧后台超级管理员登录平台", -1));
const _hoisted_3 = { class: "user df ai-c" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  setup(__props) {
    const store = useCounterStore();
    const { userInfo } = storeToRefs(store);
    const router = useRouter();
    const menuItem = ref([
      {
        name: "首页",
        id: "1",
        icon: "",
        path: "/home"
      },
      {
        name: "下级代理",
        id: "2",
        icon: "",
        path: "/juniorAgent"
      },
      {
        name: "网吧管理",
        id: "3",
        icon: "",
        path: "/bar"
      },
      {
        name: "卡密管理",
        id: "4",
        icon: "",
        path: "/codePass"
      },
      {
        name: "日志管理",
        id: "5",
        icon: "",
        path: "/log"
      },
      {
        name: "商品码",
        id: "6",
        icon: "",
        path: "/shopCode"
      }
    ]);
    const visible = ref(false);
    const loguOut = () => {
      localStorage.clear();
      router.push("/login");
    };
    return (_ctx, _cache) => {
      const _component_el_menu_item = resolveComponent("el-menu-item");
      const _component_el_sub_menu = resolveComponent("el-sub-menu");
      const _component_el_menu = resolveComponent("el-menu");
      const _component_el_header = resolveComponent("el-header");
      const _component_el_aside = resolveComponent("el-aside");
      const _component_router_view = resolveComponent("router-view");
      const _component_el_main = resolveComponent("el-main");
      const _component_el_container = resolveComponent("el-container");
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createVNode(_component_el_container, null, {
          default: withCtx(() => [
            createVNode(_component_el_header, { class: "df ai-c jc-sb" }, {
              default: withCtx(() => [
                _hoisted_2,
                createBaseVNode("div", _hoisted_3, [
                  createVNode(_component_el_menu, {
                    class: "el-menu-demo",
                    mode: "horizontal",
                    ellipsis: false,
                    "background-color": "#333333",
                    "text-color": "#fff",
                    "active-text-color": "#ffd04b"
                  }, {
                    default: withCtx(() => [
                      createVNode(_component_el_sub_menu, { index: "2" }, {
                        title: withCtx(() => [
                          createBaseVNode("h4", null, toDisplayString(unref(userInfo).username), 1),
                          createBaseVNode("img", {
                            src: _imports_0,
                            alt: "",
                            style: { "border-radius": "50%", "width": "35px", "height": "35px", "margin": "0 8px" },
                            onClick: _cache[0] || (_cache[0] = ($event) => visible.value = true)
                          })
                        ]),
                        default: withCtx(() => [
                          createVNode(_component_el_menu_item, { index: "2-2" }, {
                            default: withCtx(() => [
                              createTextVNode("修改密码")
                            ]),
                            _: 1
                          }),
                          createVNode(_component_el_menu_item, {
                            index: "2-1",
                            onClick: loguOut
                          }, {
                            default: withCtx(() => [
                              createTextVNode("退出登录")
                            ]),
                            _: 1
                          })
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  })
                ])
              ]),
              _: 1
            }),
            createVNode(_component_el_container, null, {
              default: withCtx(() => [
                createVNode(_component_el_aside, { width: "200px" }, {
                  default: withCtx(() => [
                    createVNode(HeaderMenu, {
                      menuItem: menuItem.value,
                      activeIndex: "1"
                    }, null, 8, ["menuItem"])
                  ]),
                  _: 1
                }),
                createVNode(_component_el_main, null, {
                  default: withCtx(() => [
                    createVNode(_component_router_view)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]);
    };
  }
});
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-00a973f5"]]);
export {
  index as default
};
